<#ftl output_format="HTML" auto_esc=true>
<@h.siteCommonHead title="后台管理系统" keywords="开源,永久免费" description="springrain开源系统管理后台"/>

<script src="${ctx}/js/validform/validform.min.js"></script>
<link rel="stylesheet" href="${ctx}/js/validform/validform.css" media="all">

<script  type="text/javascript"  src="${ctx}/js/lbs/s/api.js"></script>
<script type="text/javascript"  src="${ctx}/js/lbs/s/selectMap.js"></script>
<script src="${ctx}/js/lbs/s/distpicker.data.js"></script>
<script src="${ctx}/js/lbs/s/distpicker.js"></script>
<script>
	 jQuery(function(){
		 /*
		 init_valid(_before,_after)
		 @_before:提交表单前，调用 的函数   可以为空，一般有validform处理不了，独自进行处理时使用
		 @_after:保存成功后，调用的函数  可以为空，一般为对应的列表页面
		 */
		 springrain.initValid(null,function(){window.location.href="${ctx}/s/peacemap/${siteId!''}/${bussinissId!''}/list?springraintoken="+springraintoken});
	 });
</script>

</head>
<body>
	<div class="layui-layout layui-layout-admin">
		<@h.naviHeader /><@h.leftMenu />
		<!-- 主体内容开始 -->
			<div class="layui-tab layui-tab-brief">
				<ul class="layui-tab-title site-demo-title">
		            <li class="layui-this">
		            		<i class="layui-icon">&#xe630;</i>
		             		<span class="layui-breadcrumb" style="visibility: visible;">
							   <a href="${ctx}">首页<span class="layui-box">&gt;</span></a>
							   <a><cite>添加地图</cite></a>
							</span>
		            </li>
		             <li style="float:right;">
				        <button type="button" onclick="history.go(-1)" class="layui-btn layui-btn-small" style="margin-top:8px;"><i class="layui-icon layui-icon-specil">&#xe603;</i>返回</button>
		             </li>
	       		</ul>
				
				<div class="layui-body layui-tab-content site-demo-body">
					<div class="layui-tab-item layui-show">
							<div class="layui-main">
						          <div id="LAY_preview" class="layui-my-form">
						          				<header class="larry-personal-tit">
													<span>添加地图</span>
												</header>
												<div class="larry-personal-body clearfix changepwd">
													<form id="validForm" class="layui-form <!--  -->"  method="post" action="${ctx}/s/peacemap/${siteId!''}/${bussinissId!''}/update">
																<input type="hidden" id="id" name="id" value="${id!''}"/>	
																<input type="hidden" name="siteId" id="siteId" datatype="*" nullmsg="不能为空" errormsg="不能为空！" autocomplete="off" class="layui-input" value="${siteId!''}">
																<input type="hidden" name="channelId" id="channelId" datatype="*" nullmsg="不能为空" errormsg="不能为空！" autocomplete="off" class="layui-input" value="${bussinissId!''}">
																
																	<div class="layui-form-item col-lg-6">
																		<label class="layui-form-label">名称*</label>
																		<div class="layui-inline col-lg-5">  
																			<input type="text" name="name" id="name" datatype="*" nullmsg="不能为空" errormsg="不能为空！" autocomplete="off" class="layui-input" value="">
																		</div>
																		<div class="layui-inline valid-info"></div>
																	</div>
																	<div class="layui-form-item col-lg-6">
																		<label class="layui-form-label">所在市*</label>
																		<div class="layui-inline col-lg-5">  
																			<input type="text" name="city" id="city" datatype="*" nullmsg="不能为空" errormsg="不能为空！" autocomplete="off" class="layui-input" value="">
																		</div>
																		<div class="layui-inline valid-info"></div>
																	</div>
																	<div class="layui-form-item col-lg-6">
																		<label class="layui-form-label">电话号码*</label>
																		<div class="layui-inline col-lg-5">  
																			<input type="text" name="tel" id="tel" datatype="*" nullmsg="不能为空" errormsg="不能为空！" autocomplete="off" class="layui-input" value="">
																		</div>
																		<div class="layui-inline valid-info"></div>
																	</div>
																	<div class="layui-form-item col-lg-6">
																		<label class="layui-form-label">详细地址*</label>
																		<div class="layui-inline col-lg-5">  
																			<input type="text" name="poiaddress" id="poiaddress" datatype="*" nullmsg="不能为空" errormsg="不能为空！" autocomplete="off" class="layui-input" onclick="show(this);" value="">
																		</div>
																		<div class="layui-inline valid-info"></div>
																	</div>
																	<div class="layui-form-item col-lg-6">
																		<label class="layui-form-label">纬度*</label>
																		<div class="layui-inline col-lg-5">
																			<input type="text" name="lat" id="lat" datatype="*" nullmsg="不能为空" errormsg="不能为空！" autocomplete="off" readonly="readonly" class="layui-input" onclick="show(this);" value="">
																		</div>
																		<div class="layui-inline valid-info"></div>
																	</div>
																	<div class="layui-form-item col-lg-6">
																		<label class="layui-form-label">经度*</label>
																		<div class="layui-inline col-lg-5">  
																			<input type="text" name="lng" id="lng" datatype="*" nullmsg="不能为空" errormsg="不能为空！" autocomplete="off" readonly="readonly" class="layui-input" onclick="show(this);" value="">
																		</div>
																		<div class="layui-inline valid-info"></div>
																	</div>
																	
																	<div class="layui-form-item col-lg-6">
																		<label class="layui-form-label">排序*</label>
																		<div class="layui-inline col-lg-5">  
																			<input type="text" name="sort" id="sort" datatype="*" nullmsg="不能为空" errormsg="不能为空！" autocomplete="off" class="layui-input" value="">
																		</div>
																		<div class="layui-inline valid-info"></div>
																	</div>
													<div class="layui-form-item change-submit">
													<label class="layui-form-label"></label>
															<div class="layui-inline">
																<button type="button" class="layui-btn" id="smtbtn">保存</button>
																<button type="button" class="layui-btn layui-btn-primary" id="rstbtn">重置</button>
															</div>
														</div>
													</form>
												</div>
								  </div>
							</div>
					</div>
			</div>
		</div>
		
		<!-- 主体内容结束 -->
		<@h.footer />
	
	</div>
	
	<script type="text/javascript">
	var _ctx="${ctx}";
	function show(){
		  initMap(); 
		 layer.open({
		      type: 1,
		      title: "选择经纬度",
		      area: ['830px', '600px'], //宽高
		      content: $("#mapWrap"),
		      closeBtn: 1,
		      shade:false,
		      btn: ['确定'], //按钮
		      yes:function(index, layero){
		    	  /* var _dizhi=$("#addressName").val();
		    	  var _lat=$("#weidu").val();
		    	  var _lng=$("#jingdu").val();
		    	  if($("#addressName").val()&&){
		    		  
		    	  } */
		    	  $("#poiaddress").val($("#addressName").val());
		    	  $("#lat").val($("#weidu").val());
		    	  $("#lng").val($("#jingdu").val());
		    	  $("#city").val($("#search_city").val());
		          layer.close(index); //如果设定了yes回调，需进行手工关闭
		      }
	    });
		
	}
	
	</script>
	<style>
	.info_list {
    margin-bottom: 5px;
    cleat: both;
    cursor: pointer;
	}
	</style>
	<div id="mapWrap" style="display:none;width:95%;margin:0px auto;">
		<fieldset style="border:1px solid #d3d3d3;">
			<legend>搜索</legend>
			<div data-toggle="distpicker">
	  			<select class="layui-input" style="display:inline-block;width:20%;"  data-province="---- 选择省 ----"></select>
	  			<select class="layui-input" style="display:inline-block;width:20%;"  id="search_city" data-city="---- 选择市 ----"></select>
				<input class="layui-input" style="display:inline-block;width:40%;" id='address' >
				<button class="layui-btn" id="shousuo"  type="button"><i class="layui-icon" style="top:4px;right:5px;">&#xe615;</i>搜索</button>
			</div>
			<br>
			点选结果：<input style="border:none;width:80px;" id='weidu'>
			<input style="border:none;width:80px;" id="jingdu">
			地址:<input style="border:none;width:300px;" id='addressName'>
			 
		</fieldset>
			
	 
		<div name="container" id="container" style="width:100%;height:390px;margin:0px auto;margin-top:10px;"></div>
		
	</div>
	
	
</body>
</html>
